<form onsubmit="return false;" data-auto="true" method="post" class='layui-form layui-card shadow-none' autocomplete="off">

    <div class="layui-card-header border-0">
        <div class="layui-bg-gray padding-col-20 border-radius-5 layui-elip">
            使用微信开放平台授权模式时，需要使用楚才开放平台的 <span>微信授权</span> 服务，接口需要使用 <span>Yar</span> 或 <span>JsonRpc</span> 通信。
        </div>
    </div>

    <div class="layui-card-body">

        <!--{if !empty($wechat)}-->
        <div class="layui-form-item margin-bottom-20">
            <label class="layui-form-label"><b>QRCode</b><br><span class="nowrap color-desc">公众号二维码</span></label>
            <div class="layui-input-block">
                <div class="pull-left notselect">
                    <div class="shadow" data-tips-image data-lazy-src="{$wechat.qrcode_url|down_file}" style="width:95px;height:95px"></div>
                </div>
                <div class="pull-left padding-left-10">
                    <p class="nowrap">微信昵称：{$wechat.user_nickname|default='-'}</p>
                    <p class="nowrap">微信类型：{$wechat.service_type|default='-'} / {$wechat.service_verify == '未认证' ? '未认证' : '<span class="color-green">已认证</span>'}</p>
                    <p class="nowrap">注册公司：{$wechat.user_company|default='-'}</p>
                    <p class="nowrap">授权绑定：{$wechat.create_at|format_datetime}</p>
                </div>
            </div>
        </div>
        <div class="hr-line-dashed"></div>
        <!--{/if}-->

        <div class="layui-form-item">
            <label class="layui-form-label"><b>Authorize</b><br><span class="nowrap color-desc">绑定微信授权</span></label>
            <div class="layui-input-block">
                <button type="button" data-href="{$authurl|default=''}" class="layui-btn layui-btn-sm layui-btn-primary">重新绑定公众号</button>
                <p class="help-block">点击链接将跳转到微信第三方平台进行公众号授权。</p>
                {if !empty($message)}<p class="color-red">{$message|default=''}</p>{/if}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><b>AppId</b><br><span class="nowrap color-desc">公众号 AppId</span></label>
            <div class="layui-input-block">
                <input name="wechat.thr_appid" placeholder="请输入以wx开头的18位公众号AppId（必填）" pattern="^wx[0-9a-z]{16}$" maxlength="18" required value="{:sysconf('wechat.thr_appid')}" class="layui-input">
                <p class="help-block">众号 appid 通过微信第三方授权自动获取. 若没有值请进行微信第三方授权。</p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><b>AppKey</b><br><span class="nowrap color-desc">服务接口密钥</span></label>
            <div class="layui-input-block">
                <label class="relative block">
                    <input name="wechat.thr_appkey" required placeholder="请输入32位第三方平台接口密钥AppKey（必填）" value="{:sysconf('wechat.thr_appkey')}" maxlength="32" pattern="^[0-9a-z]{32}$" class="layui-input">
                    <p class="help-block">公众号服务平台接口密钥, 通过微信第三方授权自动获取, 若没有值请进行微信第三方授权。</p>
                </label>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label"><b>PushApi</b><br><span class="nowrap color-desc">服务推送接口</span></label>
            <div class="layui-input-block">
                <label class="relative block">
                    <input value="{$thrNotify}" disabled class="layui-input layui-bg-gray">
                    <a data-copy="{$thrNotify}" class="layui-icon layui-icon-release input-right-icon"></a>
                </label>
                <p class="help-block">公众号绑定服务平台接口通知 URL, 公众号消息接收与回复等。</p>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    <input type="hidden" name="wechat.type" value="thr">

    <div class="layui-form-item text-center">
        <button class="layui-btn" type="submit">保存配置</button>
    </div>
</form>